package com.lh.mapper;

import com.lh.entity.Article;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
public interface ArticleMapper {
    @Insert("insert into article( title, content, cover_img, state, category_id, create_user, create_time, update_time) " +
            "values(#{title},#{content},#{coverImg},#{state},#{categoryId},#{createUser},now(),now()) ")
    int addArticle(Article article);

    //查询条件为动态查询所以需要使用动态sql，创建ArticleMapper.xml配置文件完成
    //注意ArticleMapper.xml必须和ArticleMapper在同一个目录并且名字也有一样
    //创建路径时要用/不能用.，如com/lh/mapper
    List<Article> articleList(Integer categoryId, Integer createUser, String state);
}
